package com.lance.core.launch.properties;

import com.google.common.collect.Maps;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.Map;

/**
 * @author lancecong
 * @version 1.0
 * @ClassName LanceProperties
 * @DESCRIPTION 属性文件
 * @create 2019-06-28 17:31
 **/
@ConfigurationProperties("lance")
@Data
public class LanceProperties {
    /**
     * 环境
     */
    private String env ;

    private String name;

    private final Map<String,String> prop = Maps.newHashMap();

    /**
     * 获取value
     * @param key
     * @return
     */
    public String get(String key){
        return get(key,null);
    }

    public String get(String key, String defaultValue) {
        String value = prop.get(key);
        if(null==value){
            return defaultValue;
        }
        return value;
    }
}
